from openpyxl import load_workbook
import time
 
# 加载两个Excel文件
wb1 = load_workbook('D:/wwwroot/Python/tool/files/parent.xlsx')

 
# 选择工作表
sheet1 = wb1.active

 
rowIndex = 2
# 比对两个表格，这里以第一列作为关键字比对
for row1 in sheet1.iter_rows(min_row=2):  # 假设第一行是标题行，从第二行开始
    studentName = row1[0].value
    parentName = str(row1[0].value)+'家长'

    if studentName == None :
        break

    sheet1.cell(row=rowIndex, column=4).value = parentName
    rowIndex = rowIndex +1        
 
# 保存修改后的文件
fileName = str(time.time())+'_parent'
wb1.save('D:/wwwroot/Python/tool/files/'+fileName+'.xlsx')